package com.stm.bi.service;

import com.stm.bi.dto.query.ChartReportQry;
import com.stm.bi.dto.query.DetailChartReportQry;
import com.stm.bi.dto.query.TableReportQry;
import com.stm.bi.model.Chart;
import com.stm.bi.model.DatatablePage;
import com.stm.bi.report.productTrend.ProductTrendChartQueryExe;
import com.stm.bi.report.productTrend.ProductTrendDetailChartQueryExe;
import com.stm.bi.report.productTrend.ProductTrendTableQueryExe;
import com.stm.framework.dto.Response;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.List;

@Service
public class ProductTrendService {

    @Resource
    private ProductTrendChartQueryExe productTrendChartQueryExe;
    @Resource
    private ProductTrendDetailChartQueryExe productTrendDetailChartQueryExe;
    @Resource
    private ProductTrendTableQueryExe productTrendTableQueryExe;

    public Response<Chart<List<List<Object>>>> queryChart(ChartReportQry qry) {
        return productTrendChartQueryExe.query(qry);
    }

    public Response<Chart<List<List<Object>>>> queryDetailChart(DetailChartReportQry qry) {
        return productTrendDetailChartQueryExe.query(qry);
    }

    public Response<DatatablePage> queryTable(TableReportQry qry) {
        return productTrendTableQueryExe.query(qry);
    }


    public void export(HttpServletResponse response, TableReportQry qry) throws IOException {
        productTrendTableQueryExe.export(response, qry);
    }
}
